/* 	DUK Lib js
 
	Author:			Mat J (matt@designuk.com)
 	Job No:			duk077
 	File:			lib.css
 	Description:	Basic js lib DUK site
	Dependencies:	jQuery-1.2.6.min.js
					jquery.dimensions.min.js	--	jQuery plugin
 	----------------------------------------------------------------- */
	
$(document).ready(function() {

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Inner bits AND them but not me rollovers - applied to all .vis_link items in a page (ie homepage, showcase)
	
	$('li.vis_link a').each(function(i) {
		// get heights etc for each item
		
		this.myHeight = $(this).parent().outerHeight();	// dimensions plugin dependency
		this.inPos = this.myHeight - $(this).children('span.link_panel').children('strong').outerHeight();
		this.outPos = this.myHeight - $(this).children('span.link_panel').outerHeight();
		// reposition link text elements at bottom (part overflowing)
		$(this).children('span.link_panel').css({'position' : 'absolute', 'top' : this.inPos + 'px'	});
		
		$(this).bind("mouseenter focus", function() {
				$(this).parent().addClass('focal');
				
				$('li.vis_link:not(.focal)')
					.stop()
					.animate({ 'opacity' : 0.6 }, 300, 'easeOutQuad');	// easing plugin
				var $outPos = this.outPos;
				$(this).children('span.link_panel')
					.stop()
					.animate({ 'top' : $outPos + 'px' }, 300, 'easeOutQuad');	// easing plugin
			})

			.bind("mouseleave blur", function() {
				$('li.vis_link:not(.focal)')
					.stop()
					.animate({ 'opacity' : 1 }, 300, 'easeOutQuad');	// easing plugin
				$(this).parent().removeClass('focal');
					var $inPos = this.inPos;
				$(this).children('span.link_panel')
					.stop()
					.animate({ 'top' : $inPos + 'px' }, 300, 'easeOutQuad');	// easing plugin
		})
	});	
});